// src/store/modules/elements.js
export default {
    state: {
      elements: ""
    },
    mutations: {
      SET_ELEMENTS(state, elements) {
        state.elements = elements;
        localStorage.setItem('elements', JSON.stringify(elements));
      },
      ADD_ELEMENT(state, element) {
        if (!state.elements.includes(element)) {
          state.elements.push(element);
          localStorage.setItem('elements', JSON.stringify(state.elements));
        }
      }
    },
    actions: {
      addElement({ commit }, element) {
        commit('ADD_ELEMENT', element);
      }
    }
  };